﻿<Window xmlns:uiExample="clr-namespace:UIExample.View" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"  
        xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:behavior="clr-namespace:UIExample.Behavior"

        mc:Ignorable="d"  x:Class="UIExample.MainWindow"
        Title="WK35705UIExample" Height="436" Width="717">
    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
    </Window.Resources>

    <Window.DataContext>
        <Binding Mode="OneWay" Path="Main" Source="{StaticResource Locator}"/>
    </Window.DataContext>
    <Grid Margin="0"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch">

        <ItemsControl Visibility="{Binding FilterOff, Converter={StaticResource BooleanToVisibilityConverter}}"  Margin="0"   ItemsSource="{Binding LinkCollection}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <ed:BlockArrow HorizontalAlignment="Left" VerticalAlignment="Top" Fill="Tomato"  Margin="{Binding Margin}" 
                                Stroke="Black" Height="{Binding Thickness}" Width="{Binding Length}" RenderTransform="{Binding Rotate}" RenderTransformOrigin="0,0.5"/>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Grid Margin="0,0,-4000,-4000"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
        <DockPanel Margin="0"  >
            <Grid VerticalAlignment="Stretch"  Margin="0" Width="137" DockPanel.Dock="Left">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>
                <StackPanel Grid.Row="0">
                    <Button Command="{Binding LoadUMPXML}" Content="Load UMPs XML" />
                <Button Command="{Binding Clear}" Content="Clear" />
                <Button Command="{Binding SaveSystem}" Content="Save System" />
                <Button Command="{Binding LoadSystem}" Content="Load System" />
                <ComboBox ItemsSource="{Binding Sets}" SelectedValue="{Binding ActiveSet}" />
            </StackPanel>
            <ListBox Grid.Row="1" Margin="0,0,0,0"   VerticalAlignment="Stretch"  ItemsSource="{Binding UMPItems}">
                    <ListBox.ItemTemplate>
                        <DataTemplate >
                            <Grid Width="123" Height="100" Background="White">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="6*"/>
                                    <ColumnDefinition Width="29*"/>
                                    <ColumnDefinition Width="6*"/>
                                </Grid.ColumnDefinitions>
                                <i:Interaction.Behaviors>
                                    <behavior:FrameworkElementDragBehavior/>
                                </i:Interaction.Behaviors>
                                <Border BorderThickness="2" HorizontalAlignment="Stretch" VerticalAlignment="Center" BorderBrush="#FFA69898" Margin="0,30.02" Grid.Column="1" >
                                    <Viewbox >
                                        <TextBlock Text="{Binding name}" TextAlignment="Center"  TextWrapping="NoWrap"  IsEnabled="False" Margin="5"/>
                                    </Viewbox>
                                </Border>

                                <ed:BlockArrow Grid.Column="0" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="1" 
                                           Margin="0,42.04,0,0" Orientation="Right" Stroke="Black" VerticalAlignment="Top" Width="27.5"/>
                                <ed:BlockArrow Grid.Column="0" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="1" 
                                           Margin="0,58.04,0,0" Orientation="Right" Stroke="Black" VerticalAlignment="Top" Width="27.5"/>
                                <ed:BlockArrow Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="1" Margin="0,42.04,0,0" 
                                           Orientation="Right" Stroke="Black" VerticalAlignment="Top" Width="27.5" Grid.Column="2"/>

                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Grid>
           
                <Grid>
               
            <!--<helpControles:ZoomBoxPanel  Background="WhiteSmoke" WheelMode="Zoom"    ZoomMode="FitPage" >-->
                <ScrollViewer Background="Transparent" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" >
                    <!--HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True"-->
                <ItemsControl ItemsSource="{Binding DeployedUMPs}" MinHeight="405" MinWidth="500">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <uiExample:UMPView Margin="{Binding Margin}"/>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>

                               <!-- <ScrollViewer Background="Transparent" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" >-->

                                    <Grid  AllowDrop="True" Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                <i:Interaction.Behaviors>
                                    <behavior:FrameworkElementDropBehavior/>
                                </i:Interaction.Behaviors>
                            </Grid>
                             
            </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>

                    <!--Grid  AllowDrop="True" Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                    <i:Interaction.Behaviors>
                        <behavior:FrameworkElementDropBehavior/>
                    </i:Interaction.Behaviors>
                </>-->

                </ItemsControl>
                    </ScrollViewer>
            <!--</helpControles:ZoomBoxPanel>-->
                
            </Grid>
            
        </DockPanel>

    </Grid>

</Window>
